yjx.controller('toAskController', ['$scope', '$timeout', '$fetch', 'modalService', '$state', '$init', function ($scope, $timeout, $fetch, modalService, $state, $init) {
    $init.title("在线问答")
    var api = '/QandA/publish';
    var params = {}
    $scope.submit = function () {
        if($scope.title){
            params.title = $scope.title
        }
        if($scope.body){
            params.body = $scope.body
        }
            $fetch.fetch(
                api,
                {
                    params: params,
                    type: 'post'
                }
            ).then(function(data){
                $scope.title='';
                $scope.describe='';
                $state.go('ask');
            }).catch(function(e){
                modalService.mainMsgError(e.msg);
            })
    }
   

}])